package com.google.gwt.sample.json.client;

import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.client.Window;

import therandomhomepage.widgets.client.LightboxImage;

public class Images extends DialogBox {

	public Images() {
		super(true);
        setPopupPositionAndShow(new PopupPanel.PositionCallback() {
            public void setPosition(int offsetWidth, int offsetHeight) {
              int left = (Window.getClientWidth() - offsetWidth) / 3;
              int top = (Window.getClientHeight() - offsetHeight) / 3;
              setPopupPosition(left, top);
            }
        });
		setHTML("Photo Viewer");

//		final FlexTable flexTable = new FlexTable();
//		setWidget(flexTable);
//		setText("Photo Viewer");
//		flexTable.setSize("100%", "100%");
//		flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER);
//

		final VerticalPanel verticalPanel = new VerticalPanel();
		//flexTable.setWidget(0, 0, horizontalPanel_1);
		setWidget(verticalPanel);
		verticalPanel.setStyleName("gwt-Label2");
		verticalPanel.setSize("100%", "100%");

		final Image image = new Image();
		//verticalPanel.add(image);
		verticalPanel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
		verticalPanel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);
		image.setUrl("home.gif");
		image.setHeight("250px");
        Image images[] = {image, image, image};
        LightboxImage lightboxImage = new LightboxImage(images,true,3);
		verticalPanel.add(lightboxImage);
		lightboxImage.startSlideshow();

		final HorizontalPanel horizontalPanel = new HorizontalPanel();
		verticalPanel.add(horizontalPanel);
		verticalPanel.setSize("100%", "100%");
		verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		

		final Label nrxtLabel = new Label("Previous");
		horizontalPanel.add(nrxtLabel);
		nrxtLabel.setStyleName("gwt-NextLastButton");
		nrxtLabel.setSize("100px", "20px");
		horizontalPanel.setCellHorizontalAlignment(nrxtLabel, HasHorizontalAlignment.ALIGN_CENTER);

		final Label nextLabel = new Label("Next");
		horizontalPanel.add(nextLabel);
		nextLabel.setStyleName("gwt-NextLastButton");
		nextLabel.setSize("100px", "20px");
		horizontalPanel.setCellHorizontalAlignment(nextLabel, HasHorizontalAlignment.ALIGN_CENTER);
		Button b2 = new Button("Close");
		verticalPanel.add(b2);
		b2.addClickListener(new ClickListener() {
		      public void onClick(Widget sender) {
		    	  hide();
		      }
		    });
		
	}

}
